#coding:utf-8

import json
import urllib

URI = 'http://0.0.0.0:5353/cut'

def getCutText(text,uri=URI):
    if isinstance(text,unicode):
        text = text.encode('utf-8')
    data = {'line':text}
    data = urllib.urlencode(data)
    rp = urllib.urlopen(uri,data)
    res = rp.read()
    return res.decode('utf-8')

if __name__ == '__main__':

    print 'Hi'

    line = u'苹果用户必看 iPhone 静音键的秘密'
    print getCutText(line)

